﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-itunes-app" content="app-id=591578609">
<meta name="viewport" content="width=device-width"/>
<meta name="description" content="筑学堂网校" />
<meta name="keywords" content="筑学堂网校、建筑、考试"/>
<link href="http://www.zhuclass.com/img/icon.ico" type="image/x-icon" rel="icon"  />
<link href="http://www.zhuclass.com/img/icon.ico" type="image/x-icon" rel="shortcut icon"  />
<link rel="stylesheet" type="text/css" href="../../style/share/style.css">
<link rel="stylesheet" type="text/css" href="../../style/share/kczx.css">
<link rel="stylesheet" type="text/css" href="../../style/share/home_style.css">
<link rel="stylesheet" type="text/css" href="../../style/user.css">
<!--[if IE 7]>
<link rel="stylesheet" href="/css/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->

<script type="text/javascript" src="../js/home.js"></script>
<script type="text/javascript" src="../../js/ajaxfileupload.js"></script>
  <script type="text/javascript">
    function ajaxFileUpload(group_id)
    {
        
        $("#loading")
        .ajaxStart(function(){
            $(this).show();
        })//开始上传文件时显示一个图片
        .ajaxComplete(function(){
            $(this).hide();
        });//文件上传完成将图片隐藏起来
        
        $.ajaxFileUpload
        (
            {
                url:'${uploadImgURL}',//用于文件上传的服务器端请求地址
                secureuri:false,//一般设置为false
                fileElementId:'fileInput',//文件上传空间的id属性  <input type="file" id="file" name="file" />
                dataType: 'json',//返回值类型 一般设置为json
                success: function (data, status)  //服务器成功响应处理函数
                {
                	if(data.code != 1)
                    {
                		var url = "../update_group_img";
                		$.ajax({ url: url, 
                			type:"post",
                 		    data:{
                 		    	group_id:'${group_id}',
                 		    	group_img:data.id,
                 		    },
               		       success: function(result){
               	           		alert('修改成功！');
     	          	        }
     	          	       });
                		
                         $("#showimg").show();
                         $("#showimg").attr("src","${showImgURL}"+data.id)
                    }else{
                    	alert(data.msg)
                    }
                },
                error: function (data, status, e)//服务器响应失败处理函数
                {
                    alert(e);
                }
            }
        )
        
        return false;

    }
    
    function cancel(group_id){
    	window.location.href="../query_group_main/"+group_id; 
    }
    </script>
<title>筑学堂家园个人空间</title>
<style type="text/css">
a {
	color:#222;
}
a:hover {
	color:#888;
}
li {
	list-style-type:none;
	border:none;
}
</style>
</head>
<body style="align:center; padding:0;margin:0;clear:both; background-color:FFF;">
	<div class="user_body01">
		<div class="home_grnottit">上传群头像</div>
		<div class="zy_left" style="border:none;margin-left:90px;">
			<div class="zy_left0101"> 
				<c:if test="${group_img == null}">
					<img src="../../images/group01.jpg"   id="showimg"/> 
				</c:if>
				<c:if test="${group_img != null}">
					<img src="${showImgURL}${group_img}"   id="showimg"/> 
				</c:if>
			</div>
		</div>
		
		<div style="position:relative;float:left;width:400px;height:200px;margin-top:20px;text-align:left;">
		<p> 您可以上传 JPG、GIF、BMP 或 PNG 文件（文件大小上限为 5Mb）。图片尺寸为160x160。</p>
		<div class="zy_left0102" style="margin-top:10px;">
			<div class="pics_divaddad" style="margin-top:10px;background-color:#9BCBCD;height:28px;">
				<div class="opac" style="width:90px;overflow:hidden;">
					<form>
						<input type="file" id="fileInput"  name="uploadImg" accept="file">
					</form>
				</div>
				上传头像 </div>
			<div class="per_record"> <a href="#" onclick="ajaxFileUpload('${group_id}')"> <span class="per_recorddiv">确认上传 </span> </a> <a href="#"  onclick="cancel('${group_id}')"> <span class="per_recorddiv" style="margin-left:12px;">取消 </span> </a> </div>
		</div>
	</div>
	</div>
</body>
</html>